import fetch from "common/src/utils/fetch";

/**
 *  录入监考排考查询
 */
function getListPage(data) {
  return fetch({
    url: "/api/electionservice/common/fxExamTeacher/getListPage",
    method: "post",
    data
  });
}

/**
 *  录入监考老师
 */
function setInvigilator(data,examRoomId,examInfoIds,teacherCode,isExamInClass) {
  return fetch({
    url: "/api/electionservice/common/fxExamTeacher/setInvigilator?examRoomId="+examRoomId+"&examInfoIds="+examInfoIds+"&teacherCodes="+teacherCode+"&isExamInClass="+isExamInClass,
    method: "post",
    data
  });
}

/**
 *  删除监考
 */
function deleteInvigilation(data,calendarId) {
  return fetch({
    url: "/api/electionservice/common/fxExamTeacher/delete?calendarId="+calendarId ,
    method: "delete",
    data
  });
}

/**
 *  录入监考排考查询-研究生查询
 */
function getExamListPage(data) {
  return fetch({
    url: "/api/electionservice/underGraduateExamTeacher/getExamListPage",
    method: "post",
    data
  });
}

/**
 *  修改监考老师
 */
function updateInvigilator(data,examRoomId,examInfoIds,teacherCode,isExamInClass) {
  return fetch({
    url: "/api/electionservice/common/fxExamTeacher/updateInvigilator?examRoomId="+examRoomId+"&examInfoIds="+examInfoIds+"&teacherCodes="+teacherCode+"&isExamInClass="+isExamInClass,
    method: "post",
    data
  });
}

/**
 * 导出
 * @param {Object} data
 */
export function entryInvigilationExport(data) {
  return fetch({
    url: '/api/electionservice/common/fxExamTeacher/export',
    method: 'post',
    data
  })
}

/**
 * 获取key
 */
function exportStatus(key) {
  return fetch({
    url: '/api/electionservice/underGraduateExamTeacher/result/' + key,
    method: 'get'
  });
}

/**
 * 教师考试查询-我的监考-录入监考（保存）
 * @param params 考生集合的缺考情况
 */
export function saveEntryInvigilator(data,calendarId) {
  return fetch({
    url: '/api/electionservice/undergraduateExamDefect/saveEntryInvigilator?calendarId='+calendarId,
    method: 'post',
    data
  })
}

/**
 * 教师考试查询-我的监考-录入监考（保存）
 * @param params 考生集合的缺考情况
 */
export function commitEntryInvigilator(data) {
  return fetch({
    url: '/api/electionservice/undergraduateExamDefect/commitEntryInvigilator',
    method: 'post',
    data
  })
}

export default {
  getListPage: getListPage,
  deleteInvigilation: deleteInvigilation,
  entryInvigilationExport:entryInvigilationExport,
  exportStatus:exportStatus,
  getExamListPage:getExamListPage,
  setInvigilator:setInvigilator,
  updateInvigilator: updateInvigilator,
  saveEntryInvigilator:saveEntryInvigilator,
  commitEntryInvigilator:commitEntryInvigilator,
};
